<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>消息提醒</title>
    <script src="../../../js/header.js"></script>
</head>
<body>
<div id="pub"style="min-height: 750px;overflow: hidden;">
    <el-row type="flex" justify="center">
        <el-col :span="15">
            <el-breadcrumb separator-class="el-icon-arrow-right" style="margin-top: 20px;">
                <el-breadcrumb-item :to="{ path: '/' }"  @click.native="gobackmain()">首页</el-breadcrumb-item>
                <el-breadcrumb-item>消息提醒</el-breadcrumb-item>
            </el-breadcrumb>
            <div style="margin-top: 30px;">
                <div style="margin-top: 10px;">
                    <el-form :model="selectForm" :rules="rules" ref="selectForm" label-width="150px">
                        <el-row>
                            <el-col :span="10">
                                <el-form-item label="举报主题:" prop="" label-width="110px">
                                    <el-input v-model="selectForm.title" placeholder="" :disabled="selectFormDisabled"></el-input>
                                </el-form-item>
                            </el-col>
                        </el-row>
                        <el-row>
                            <div style="float: right;">
                                <el-button type="primary" size="small" styl e="width: 60px;height: 30px;" @click="searchForm('selectForm')">查询</el-button>
                                <el-button type="warning" size="small" style="width: 60px;height: 30px;" @click="resetForm('selectForm')">重置</el-button>
                            </div>
                        </el-row>
                    </el-form>
                </div>
            </div>

            <!--展示列表-->
            <el-table :data="tableData" border style="width: 100%;margin-top: 35px;" :header-cell-style="{background:'#eef1f6',color:'#606266'}">
                <el-table-column type="selection" ></el-table-column>
                <el-table-column
                        prop=""
                        type="index"
                        label="序号"
                        width="50"
                        align="center" >
                </el-table-column>
                <el-table-column
                        prop="complainTopic"
                        label="举报主题"
                        width="150"
                        align="center">
                </el-table-column>
                <el-table-column
                        prop="complainContent"
                        label="举报内容"
                        align="center">
                </el-table-column>
                <el-table-column
                        prop="complainTime"
                        label="创建时间"
                        width="150"
                        align="center">
                </el-table-column>
                <el-table-column
                        prop="complainStatus"
                        label="状态"
                        width="100"
                        align="center">
                    <template slot-scope="scope">
                        <span v-if="scope.row.complainStatus==0">未提交</span>
                        <span v-if="scope.row.complainStatus==1">待处理</span>
                        <span v-if="scope.row.complainStatus==2">已处理</span>
                    </template>
                </el-table-column>
                <el-table-column
                        prop="dealTime"
                        label="处理时间"
                        width="250"
                        align="center">
                </el-table-column>
                <el-table-column
                        label="操作"
                        width="150"
                        align="center">
                    <template slot-scope="scope">
                        <el-button size="mini" @click="view(scope.$index,scope.row)">查看详情</el-button>
                    </template>
                </el-table-column>
            </el-table>
            <div style="overflow: hidden;">
                <div class="pagination">
                    <el-pagination
                            @size-change="handleSizeChange"
                            @current-change="handleCurrentChange"
                            :current-page="currentPage"
                            :page-sizes="[5,10, 20, 30, 40]"
                            :page-size="pagesize"
                            background
                            layout="total, sizes,prev, pager, next"
                            :total="tableTotal"
                            prev-text="上一页"
                            next-text="下一页">
                    </el-pagination>
                </div>
            </div>
            <!--详情-->
            <el-dialog title="" :visible.sync="dialogView" center fullscreen>
                <wgr-complaint :wgr-form="addForm" :add-form="false" :form-disabled="false" :name-disabled="false" :com-link="link" @cancel="cancel"></wgr-complaint>
            </el-dialog>
        </el-col>
    </el-row>
</div>
</body>
<script type="text/javascript">
    var vue = new Vue({
        el: '#pub',
        created: function () {
            var userInfo = JSON.parse(localStorage.getItem('userInfo'));
            this.name = userInfo.loginName;
        },
        data: function () {
            return {
                currentPage: 1,
                pagesize: 5,
                tableTotal:'',
                tableData: [],
                selectFormDisabled:false,
                selectForm: {
                    title:''
                },
                dialogView:false,
                uuid:'',
                from:'',
                link:'',//iframe链接
                addForm: {
                    id:"",
                    name: "",
                    sex: "",
                    phone:"",
                    address: {
                        province: '',
                        cities: '',
                        county: '',
                        random: '',
                    },
                    creatTime: "",
                    appealContent: "",
                },
                addFormDisabled:false,
                Detail : {
                    id:"",
                    name: "",
                    sex: "",
                    phone:"",
                    province: "",
                    creatTime: "",
                    appealContent: "",
                },
                provinceValue:'',
                cityValue:'',
                areaValue:'',
                provinceData: [],
                cityData: [],
                areaData: [],
                rules: {
                    name: [{
                        required: true,
                        message: '请输入姓名',
                        trigger: 'blur'
                    }],
                    sex: [{
                        required: true,
                        message: '请选择性别',
                        trigger: 'change'
                    }],
                    phone: [{
                        required: true,
                        message: '请输入联系电话',
                        trigger: 'blur'
                    }],
                    province: [{
                        required: true,
                        message: '请输入通讯地址',
                        trigger: 'blur'
                    }],
                    appealContent: [{
                        required: true,
                        message: '请输入违法活动记录',
                        trigger: 'blur'
                    },{
                        max : 500,
                        message : '请输入长度最大为500个字符',
                        trigger : 'blur'
                    }],
                    creatTime: [{
                        required: true,
                        message: '必填',
                        trigger: 'blur'
                    }]
                }
            }
        },
        mounted: function () {
            this.getData();
        },
        methods: {
            getData() {
                var pagesize = this.pagesize;
                var pageno = this.currentPage;
                axios({
                    method: 'get',
                    url: appBaseUrl + '/message/findPage',
                    params: {
                        pageSize: pagesize,
                        pageNo: pageno
                    }
                })
                .then(response => {
                    let data = response.data;
                    if (data.code == 200) {
                        debugger;
                        console.log(data);
                        let dataInformation = data.data.results;
                        this.tableTotal = data.data.total;// 数据长度
                        this.tableData = dataInformation;
                    } else {
                        this.$message.error(data.msg);
                    }
                })
                .catch(function (error) {
                    console.log(error);
                });
            },
            /* 列表页搜索 */
            searchForm(selectForm) {
                var pagesize = this.pagesize;
                var pageno = this.currentPage;

                axios({
                    method: 'get',
                    url: appBaseUrl + '/message/findPage',
                    params: {
                        pageSize: pagesize,
                        pageNo: pageno,
                        complainTopic: this.selectForm.title
                    }
                })
                .then(response => {
                    let data = response.data;
                    if (data.code == 200) {
                        console.log(data);
                        let dataInformation = response.data.data.results;
                        this.tableTotal = response.data.data.total;// 数据长度

                        this.tableData = dataInformation;
                    } else {
                        this.$message.error(data.msg);
                    }
                })
                .catch(function (error) {
                    console.log(error);
                });
            },
            // 关闭dialog
            cancel(){
                this.dialogView = false;
                this.getData();
            },
            /* 列表页重置 */
            resetForm(formName) {
                this.selectForm.title = '';
                this.getData();
            },
            //每页下拉显示数据
            handleSizeChange(size) {
                this.pagesize = size;
                this.getData();
            },
            //点击第几页
            handleCurrentChange(currentPage) {
                this.currentPage = currentPage;
                this.getData();
            },
            //获取UUID的方法
            getUuid() {
                axios({
                    method: 'get',
                    url: appBaseUrl + '/uuid/getUuid',
                })
                    .then(response => {
                    console.log(response);
                if (response.data.code == 200) {
                    this.uuid = response.data.data;
                    this.link="upload/annex.html?uuid="+this.uuid+"&flag=1";
                    console.log(this.uuid);
                } else {
                    this.$message.error(response.data.msg);
                }
            })
            .catch(function (error) {
                    console.log(error);
                });
            },
            //查看
            view(index,row){
                this.dialogView=true;
                this.addFormDisabled=true;
               // this.link = appBaseUrl + "/html/upload/annex.html?uuid="+row.linkId+"&flag=0&from="+row.from;
                axios({
                    method: 'get',
                    url: appBaseUrl + '/message/getMessage',
                    params: {
                        linkId: row.linkId,
                        id:row.id,
                    }
                })
                    .then(response => {
                    let data = response.data;
                if (data.code == 200) {
                    debugger;
                    let rowdata = response.data.data;
                    this.addForm = rowdata;
                    this.link = appBaseUrl + "/html/upload/annex2.html?uuid="+row.linkId+"&flag=0&from="+row.from;
                } else {
                    this.$message.error(data.msg);
                }
            })
            .catch(function (error) {
                    console.log(error);
                });
            },
            gobackmain(){
                parent.vue.backIndex();
            },

        },
    })
</script>
</html>